
pkgname=dhcpcd
pkgver=7.0.6
pkgrel=1
pkgdesc="RFC2131 compliant DHCP client daemon"
url="https://roy.marples.name/projects/dhcpcd/"
arch=('x86_64')
license=('BSD')
groups=('base')
depends=('glibc' 'sh')
makedepends=('ntp')
backup=('etc/dhcpcd.conf')
options=('emptydirs')  
source=("https://roy.marples.name/downloads/dhcpcd/${pkgname}-${pkgver}.tar.xz" 
        'dhcpcd@.service'
        'dhcpcd.service')
sha256sums=('727aa7ca972ab45ccad9238ae102604cca94ada87989305d04d81196d78ac341'
            '1c039df7fcf5a002336bc14f289a05606abbdbf6266d95e8e3d2dd3f02812446'
            '3e1900bead9ddcc7ec734f6d5c7e797f82dad60854c2cdc174dfc169dc5170dd')

build() {
  cd ${pkgname}-${pkgver}
  #sed -i -e 's|#include "queue.h"|#include "compat/queue.h"|' eloop.c

  ./configure --libexecdir=/usr/lib/dhcpcd \
       --dbdir=/var/lib/dhcpcd \
       --rundir=/run \
       --without-dev
  make
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} install

  # Create Binary Symlink
  install -d ${pkgdir}/usr/sbin
  ln -sf /sbin/dhcpcd ${pkgdir}/usr/sbin/dhcpcd

 install -Dm644 LICENSE ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE

  # Set Options in /etc/dhcpcd.conf
  echo noipv4ll >> ${pkgdir}/etc/dhcpcd.conf # Disable ip4vall

  # install systemd unit
  install -Dm644 ${srcdir}/dhcpcd@.service ${pkgdir}/usr/lib/systemd/system/dhcpcd@.service
  install -Dm644 ${srcdir}/dhcpcd.service ${pkgdir}/usr/lib/systemd/system/dhcpcd.service
}
